import {Routes} from '@angular/router';
import {PageNotFoundComponent} from './pages/page-not-found/page-not-found.component';
import {HomeComponent} from './pages/home/home.component';
import {LoginComponent} from './pages/login/login.component';
import {Home2Component} from './pages/home2/home2.component';
import {AuthGuard} from "./guards/auth-guard.guard";
import {Demejimmer_constants} from './const/demejimmer_constants';

export const routes: Routes = [
  //加载子路由
  {
    //独立组件加载子路由component ,loadChildren 都需要
    path: 'home',
    component: HomeComponent,
    canActivate: [
      AuthGuard
    ],
    loadChildren: () =>
      import('./pages/home/home.routes').then((m) => m.HomeComponent_ROUTES)
  },
  //{ path: 'home',component: HomeComponent},
  //{ path: 'login',loadChildren: () => import('./pages/login/login.routes').then(m => m.LoginComponent_ROUTES)},

  {
    path: Demejimmer_constants.LoginPath,
    component: LoginComponent,
    loadChildren: () =>
      import('./pages/login/login.routes').then((m) => m.LoginComponent_ROUTES)
  },
  {
    path: 'home2',
    component: Home2Component,
    loadChildren: () =>
      import('./pages/home2/home2.routes').then((m) => m.Home2Component_ROUTES)
  },
  {path: '', redirectTo: 'bpmn', pathMatch: 'full'}, // redirect to `first-component`
  {path: '**', component: PageNotFoundComponent}// 通配符路由排在最后， 404
];
